import socket,select
from helpFunc import *
import uuid,json


k = randomStringDigits(6).encode()
w = structWrapper()
w.writeArr(con_key)
w.writeArr(k)
w.writeDWord(con_maxConn)
w.writeDWord(con_cachePerConn)
w.writeDWord(con_ssPort)
w.writeDWord(serverPackLen)
w.writeDWord(serverSenLen)
w.writeDWord(con_connBufSize)
w.writeDouble(con_packEffectTime)
w.writeDouble(con_timeoutInternal)
w.writeDWord(22)

st = (100-len(w.data))*b'a'
sock = socket.socket()
add =  (serverIp, server_port)
sock.connect(add)
sock.sendall(w.data+st)
print ('server starts:')
from connc import tcpRe
l = findNPorts(2,socket.SOCK_STREAM)
t = tcpRe(l[0],l[1],con_maxConn,con_cachePerConn,con_connBufSize)
t.start(cliPackLen,con_packEffectTime,con_timeoutInternal,22,k)


